package org.zfes.snowier.common.monitor.config.ws;
import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

@Configuration
@EnableWebSocketMessageBroker
@EnableWebSocket 
public class WebSocketConfig2 implements WebSocketConfigurer,WebMvcConfigurer{ 

	  @Resource 
	  MonitorWebSocketHandler handler; 
	  
	  @Override 
	  public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { 
	    
	    registry.addHandler(handler, "/wsz").addInterceptors(new HandShake()).setAllowedOrigins("*"); 
	    registry.addHandler(handler, "/wsz/sockjs").addInterceptors(new HandShake()).setAllowedOrigins("*").withSockJS(); 
	  } 

}